package com.uyaer.engine.utils
{
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.system.ApplicationDomain;
	import flash.system.LoaderContext;
	import flash.system.Security;
	import flash.utils.getDefinitionByName;

	public class GetObject
	{
		private static var _context:LoaderContext;
		public function GetObject()
		{
		}
		
		private static function getClazz(name:String):Class{
			Security.allowDomain("*");
			return ApplicationDomain.currentDomain.getDefinition(name) as Class;
		}
		
		public static function getMc(name:String):MovieClip{
			var clazz:Class = getClazz(name);
			return (new clazz()) as MovieClip;	
		}
		
		public static function getBmd(name:String):BitmapData{
			var clazz:Class = getClazz(name);
			return (new clazz()) as BitmapData;	
		}
	}
}